-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Improve tag handling in importers and add tests for tag imports #13650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…r additional tags
valentijnscholten
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. What is the reason this PR fixes the/a problem? Is it that finding.tags = clean_tags(finding.unsaved_tags) doesn't work but finding.tags.set( clean_tags(finding.unsaved_tags)) does?
mtesauro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved
Yes. In previous versions, the tags were set before the finding was saved for the first time, so the tags would be applied normally. In today's version, the tags are set after the finding is saved, but not in the same way the other m2m relationships are managed. Since we only save the finding once in the importer now, we can't just set the tags attribute any longer. We have to use add/set in the m2m manager |
Enhance the tag processing logic in the DefaultImporter to correctly handle both lists and strings of tags. Introduce unit tests to verify the import functionality for reports containing tags.